#include<stdio.h>
#include<math.h>
#include<string.h>


int main() 
{
    char book[1001];
    gets(book);
    int n;
    scanf("%d",&n);
    getchar();
    for(int i=0;i<n;i++)
    {
    	char key[1001];
    	gets(key);
    	char *pos=book;
    	char *found;
    	if((found=strstr(pos,key))==NULL)
    	{
    		printf("Spell Not Found!");
		}
    	while((found=strstr(pos,key))!=NULL)
    	{
    		pos=found+1;
    		printf("%d ",(int)(found-book));
		}
    	printf("\n");
	}
    return 0;
}